package com.cx.mall.goods.service.impl;

import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
import com.cx.mall.common.model.goods.SpuSaleAttrValue;
import com.cx.mall.goods.mapper.SpuSaleAttrValueMapper;
import com.cx.mall.goods.service.ISpuSaleAttrValueService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lyt
 * @since 2025-07-10
 */
@Service
public class SpuSaleAttrValueServiceImpl extends ServiceImpl<SpuSaleAttrValueMapper, SpuSaleAttrValue> implements ISpuSaleAttrValueService {

    @Override
    public List<SpuSaleAttrValue> getSpuSaleAttrValues(Long spuId) {
        LambdaQueryChainWrapper<SpuSaleAttrValue> spuValueWrapper = new LambdaQueryChainWrapper<>(baseMapper);
        List<SpuSaleAttrValue> values = spuValueWrapper.eq(SpuSaleAttrValue::getSpuId, spuId)
                .select(SpuSaleAttrValue::getBaseSaleAttrId, SpuSaleAttrValue::getSaleAttrValueName)
                .list();
        return values;
    }
}
